import router from '../../router'
import store from '../../vuex/store'

function lazyLoading(url) {
  return () => import(`@/components/page/${url}`)
}

function routeGuard(isTrue) {
  store.dispatch("SET_MENULIST");
  router.addRoutes(store.state.newRoutes); //添加路由
  // console.log('store.state.menuList', store.state.newRoutes, isTrue)
  if (
   isTrue
  ) {
    //缓存已有登录信息跳转

    router.push(store.state.newRoutes[0].path);
  }


  //   window.location.reload()
  // router.beforeEach(async (to, from, next) => {
  //   console.log(to,from,next)
  // })
  // router.afterEach((to, from, next) => {
  //   console.log(to,from,next)
  // })
}
export {
  routeGuard
}
